import request from '@/utils/request'
import { BASE_URL } from '@/api/constant'

export function queryDeviceList() {
  return request({
    url: BASE_URL + '/device/tree/list',
    method: 'POST'
  })
}

export function queryDeviceListById(data) {
  return request({
    url: BASE_URL + '/device/list',
    method: 'POST',
    data
  })
}

export function deleteDeviceById(data) {
  return request({
    url: BASE_URL + '/device/delete',
    method: 'POST',
    data
  })
}

export function queryDeviceDetailById(data) {
  return request({
    url: BASE_URL + '/device/detail',
    method: 'POST',
    data
  })
}

export function queryDeviceNodeList(data) {
  return request({
    url: BASE_URL + '/device/tree/nodeList',
    method: 'POST',
    data
  })
}

export function saveOrUpdateDevice(data) {
  return request({
    url: BASE_URL + '/device/tree/saveOrUpdate',
    method: 'POST',
    data
  })
}

export function deleteDevice(data) {
  return request({
    url: BASE_URL + '/device/tree/deleteNode',
    method: 'POST',
    data
  })
}

export function saveDevice(data) {
  return request({
    url: BASE_URL + '/device/save',
    method: 'POST',
    data
  })
}

export function modifyDevice(data) {
  return request({
    url: BASE_URL + '/device/modify',
    method: 'POST',
    data
  })
}

export function replaceDevice(data) {
  return request({
    url: BASE_URL + '/device/replace',
    method: 'POST',
    data
  })
}

export function queryDeviceEarlyWarningList(data) {
  return request({
    url: BASE_URL + '/deviceEarlyWarning/list',
    method: 'POST',
    data
  })
}

export function queryDeviceMaintainRecordsList(data) {
  return request({
    url: BASE_URL + '/deviceMaintainRecords/list',
    method: 'POST',
    data
  })
}

export function downloadDeviceMaintainRecords(data) {
  return request({
    url: BASE_URL + '/deviceMaintainRecords/download',
    method: 'POST',
    responseType: 'blob',
    data
  })
}

export function downloadDeviceEarlyWarningRecords(data) {
  return request({
    url: BASE_URL + '/deviceEarlyWarning/download',
    method: 'POST',
    responseType: 'blob',
    data
  })
}
